home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: === **ptr HELP ===
- Date: 18 Apr 1996 17:30:57 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4l5u8h$1sa@sparcserver.lrz-muenchen.de>
- References: <31765AA6.41C6@cell.co.uk>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- Kai Chan <kai@cell.co.uk> writes:
-
- >Hi,
- > I've got the following code fragment. Question I've got concerns
- >passing the pointer to a pointer to func1, and that is: which is
- >correct?
-
- >blar...
- >blar...
-
- >main()
- >{
- > some_type1 **ptr;
-
- "func1()" is defined as "func1(some_type1 **ptr)" in the article
-
- > func1(ptr); /* is this right? */
-
- You pass a "some_type1 **" to func1(), which is what the function
- expects.
-
- > func1(&ptr); /* or this? */
-
- You pass a "some_type1 ***" to func1(), which is _not_ what the
- function expects.
-
- > func1(**ptr); /* or this? */
-
- You pass a "some_type1" to func1(), which is _not_ what the
- function expects.
-
- > func1(*ptr); /* or this? */
-
- You pass a "some_type1 *" to func1(), which is _not_ what the
- function expects.
-
- >
- >}
-
- Compilers are quite good at detecting type mismatch errors in calls
- to functions, all you have to do is provide a prototype for func1()
- before you try to call it.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
-